package com.zhanghe.study.springcloud2.service;


import com.zhanghe.study.springcloud2.dao.DeptDao;
import com.zhanghe.study.springcloud2.model.Dept;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author zh
 * @date 2021/8/19 12:23
 */
@Service
@Transactional
public class DeptService {

    @Autowired
    private DeptDao deptDao;

    public boolean add(Dept dept) {
        return deptDao.addDept(dept);
    }

    public Dept get(Long id) {
        return deptDao.findById(id);
    }

    public List<Dept> list() {
        return deptDao.findAll();
    }
}
